#ifndef JSONRPCSERVICE_H
#define JSONRPCSERVICE_H


#include <QObject>
#include <QTcpServer>
#include <QByteArray>
#include "jsonrpcmessage.h"



class JsonRpcService : public QObject
{
    Q_OBJECT
public:
    JsonRpcService();

    /**
     * @brief invokeSlot is a static method that meta calls the method 'methodName' of the object 'instance' with the params stored in 'params' and that potentially returns a value which will be stored
     * in 'returnValue'
     * @param instance is the object the method will invoke the slot from
     * @param methodName is the method name that the method will meta call
     * @param params is the parameter list that will be passed to the method
     * @param returnValue is the QVariant where a potential return value will be stored if any, otherwise it will be a default constructed QVariant
     * @return return the error code of the error that can occur during the call
     */
    static JsonRpcMessage::ErrorCode invokeSlot(QObject *instance, const QString& methodName, const QVariantList& params, QVariant& returnValue);


Q_SIGNALS:
    void notifyAll(const QString& methodName, const QVariantList& params = QVariantList());



};



#endif // JSONRPCSERVICE_H
